<template>
  <div class="app-page">
    <!-- 头 -->
    <div class="app-header">
      <div class="app-title">
        <i :class="$route.meta.icon"></i> {{ $route.meta.title }}
      </div>
    </div>
    <!-- 单页 -->
    <div class="app-page-padding" style="height:calc(100% - 50px)">
      <div v-loading="pageLoading" style="padding:20px 20px 0 0">
        <el-form ref="ruleForm" :model="ruleForm" :rules="rules" size="small" label-width="110px">
          <el-row>
            <el-col :span="24">
              <el-form-item label="项目名称：" prop="filed01">
                <el-input v-model="ruleForm.filed01" clearable placeholder="请填写" style="width:100%"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="项目类型：" prop="filed02">
                <el-select v-model="ruleForm.filed02" placeholder="请选择" clearable style="width:100%">
                  <el-option label="建设类" value="建设类" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="备注：" prop="filed09">
                <el-input v-model="ruleForm.filed09" type="textarea" rows="4" placeholder="请填写" style="width:100%"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="">
                <el-button size="small" class="fa fa-reply-all" @click="close">
                  关闭
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script>
import { getData } from '@/mock/index'
export default {
  name: 'DetailForm',
  data () {
    return {
      // 提交表单loading
      loading: false,
      // 页面加载完成loading
      pageLoading: false,
      // 表单
      ruleForm: {
      },
      // 验证
      rules: {
      }
    }
  },
  created () {
    this.initForm()
  },
  methods: {
    initForm () {
      // 用户uuid
      const { uuid } = this.$route.query
      if (uuid) {
        this.uuid = uuid
        this.getDetail(uuid)
      }
    },
    // 获取编辑数据
    async getDetail (uuid) {
      // 模拟详情接口
      const detailData = {
        filed01: '',
        filed02: '',
        filed03: ''
      }
      this.pageLoading = true
      const res = await getData({ userUuid: uuid }, detailData)
      this.pageLoading = false
      if (res.code === '0000') {
        this.ruleForm = res.data
      }
    },
    // 关闭跳转
    close () {
      this.closeView(this.$route)
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style  lang="scss" scoped>
</style>
